﻿<UserControl x:Class="Poker.Calculator.Wpf.Views.PokerPlayerView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:local="clr-namespace:Poker.Calculator.Wpf.Views" mc:Ignorable="d" 
             >
    <UserControl.Resources>
        <local:PercentageConverter x:Key="percentage" />
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*" />
            <ColumnDefinition Width="3*" />
        </Grid.ColumnDefinitions>
        <Grid Grid.Row="0" Grid.Column="0">
            <Grid.RowDefinitions>
                <RowDefinition Height="4*" />
                <RowDefinition Height="3*" />
                <RowDefinition Height="4*" />
            </Grid.RowDefinitions>
            <StackPanel Orientation="Vertical" Grid.Row="0" Width="140">
                <StackPanel Orientation="Horizontal">
                    <Label Content="{Binding Path=Name}" />
                    <Button Content="Fold" Height="25" Click="btnFold_Click" />
                </StackPanel>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <local:PokerCardView DataContext="{Binding Path=CardA}" Grid.Row="0" Grid.Column="0" Margin="2" CardClick="OnCardClick" />
                    <local:PokerCardView DataContext="{Binding Path=CardB}" Grid.Row="0" Grid.Column="1" Margin="2" CardClick="OnCardClick" />
                </Grid>
            </StackPanel>
            <Grid Grid.Row="1" Width="100" DataContext="{Binding Path=Statistics}" >
                <Grid.RowDefinitions>
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition />
                    <ColumnDefinition />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <local:PokerCardView DataContext="{Binding Path=OutA}" Grid.Row="0" Grid.Column="0" Margin="2" />
                <local:PokerCardView DataContext="{Binding Path=OutB}" Grid.Row="0" Grid.Column="1" Margin="2" />
                <local:PokerCardView DataContext="{Binding Path=OutC}" Grid.Row="0" Grid.Column="2" Margin="2" />
                <local:PokerCardView DataContext="{Binding Path=OutD}" Grid.Row="0" Grid.Column="3" Margin="2" />
            </Grid>
            <Grid Grid.Row="2">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="1*" />
                    <ColumnDefinition Width="1*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <local:CountedLabel Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Label="Wins" Count="{Binding Path=Statistics.Wins.Count}"/>
                <local:CountedLabel Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" Label="Losts" Count="{Binding Path=Statistics.Losts.Count}" />
                <local:CountedLabel Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" Label="Splits" Count="{Binding Path=Statistics.Splits.Count}"/>

                <Label Grid.Row="0" Grid.Column="2" VerticalAlignment="Center" Content="{Binding Path=Statistics.Wins.Percentage, Converter={StaticResource percentage}}" FontSize="24" />
                <Label Grid.Row="1" Grid.Column="2" VerticalAlignment="Center" Content="{Binding Path=Statistics.Losts.Percentage, Converter={StaticResource percentage}}" FontSize="24" />
                <Label Grid.Row="2" Grid.Column="2" VerticalAlignment="Center" Content="{Binding Path=Statistics.Splits.Percentage, Converter={StaticResource percentage}}" FontSize="24" />
            </Grid>
        </Grid>
        <StackPanel Orientation="Vertical" Grid.Row="0" Grid.Column="1">
            <local:PokerPlayerHandsView DataContext="{Binding Path=Statistics}" />
        </StackPanel>
    </Grid>
</UserControl>
